package com.ygxsk.carhome.ui.auth;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ClickUtils;
import com.blankj.utilcode.util.KeyboardUtils;
import com.blankj.utilcode.util.StringUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.flyco.roundview.RoundTextView;
import com.lxj.xpopup.core.BottomPopupView;
import com.lxj.xpopup.util.XPopupUtils;
import com.ygxsk.carhome.R;
import com.ygxsk.carhome.listener.ButtonAutoCancelListener;
import com.ygxsk.carhome.views.FJEditTextCountPublish;

/*
 * @Author:itchenqi175@163.com
 * @Time:2023-07-13  10:15
 * @Description:添加记录的弹窗内容
 */
public class AuthCancelEditReasonPopu extends BottomPopupView {

    private Context currentContext;

    //因为通用界面，标志从哪个页面过来；
    private int extra_jumpfrom_where;

    //该界面的外侧的弹窗
//    private BasePopupView basePopupView_followUp;

    private ButtonAutoCancelListener buttonAutoCancelListener;

//    private ArrayList<LeadsFollowUpInfoBean> mDataResources_followUp = new ArrayList<>();

    public AuthCancelEditReasonPopu(@NonNull Context _context,
                                    int _extra_action,
                                    ButtonAutoCancelListener _buttonAutoCancelListener) {
        super(_context);

        //不这样等于，直接 赋值 添加；
        extra_jumpfrom_where = _extra_action;
        currentContext = _context;
        buttonAutoCancelListener = _buttonAutoCancelListener;

//        if (_stationDatas != null && !_stationDatas.isEmpty()) {
//            if (mDataResources_followUp != null && !mDataResources_followUp.isEmpty()) {
//                mDataResources_followUp.clear();
//            }
//            if (mDataResources_followUp != null) {
//                mDataResources_followUp.addAll(_stationDatas);
//            }
//        }

    }

    @Override
    protected int getImplLayoutId() {//当前的这个条目内容
        //return R.layout.assetaddsubmitadapter;
        return R.layout.popu_auth_manage_cancel_reason;
    }

    @Override
    protected void onCreate() {
        super.onCreate();

        //外侧页面布局
//        LinearLayout layoutFollowUpPopu = (LinearLayout) this.findViewById(R.id.layoutfollowuppopu);
        //填充文本信息
//        TextView textViewEditFollowUp = (TextView) this.findViewById(R.id.textvieweditfollowuppopu);
        //填充 可编辑的备注信息
        FJEditTextCountPublish editViewContentPulishInRentandSell = (FJEditTextCountPublish) this.findViewById(R.id.editviewcontentauthreasonpopu);

        //两个按钮的内容  取消 和 确定
        RoundTextView textViewModifyChange = (RoundTextView) this.findViewById(R.id.textviewmodifychangeinauth);
        RoundTextView textViewComplete = (RoundTextView) this.findViewById(R.id.textviewcompleteinauth);


        if (textViewComplete != null) {
            textViewComplete.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                @Override
                public void onDebouncingClick(View v) {

                    // : 2023-07-13 14:29 需要携带什么信息？跟进状态，和备注信息？
                    //KeyboardUtils.hideSoftInput(AuthCancelEditReasonPopu.this);
                    //应该是调用一个提交接口的
                    if (buttonAutoCancelListener != null) {
                        if (editViewContentPulishInRentandSell != null) {
                            buttonAutoCancelListener.buttonAuthSure(editViewContentPulishInRentandSell.getText().toString().trim());
                        } else {
                            ToastUtils.showShort(StringUtils.getString(R.string.action_abnormal));
                        }
                    }

                }
            });
        }

        if (textViewModifyChange != null) {

            textViewModifyChange.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                @Override
                public void onDebouncingClick(View v) {

                    KeyboardUtils.hideSoftInput(AuthCancelEditReasonPopu.this);

                    if (buttonAutoCancelListener != null) {
                        buttonAutoCancelListener.buttonAuthCancel();
                    }

                }
            });

        }

    }

    @Override
    protected int getMaxHeight() {
        return (int) (XPopupUtils.getScreenHeight(getContext()) * .6f);
    }

    @Override
    protected void onShow() {
        super.onShow();
    }

    @Override
    protected void onDismiss() {
        super.onDismiss();
    }


}
